{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>编辑学校</h5>
                </div>
                <div class="ibox-content layui-form">
                    <div class="layui-row layui-col-space10 layui-form-item ">

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">学校名称：</label>
                            <div class="layui-input-block">
                                <input type="text" name="school_name" lay-verify="required" placeholder="学校名称" class="layui-input" value="{$info.school_name}">
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md10">
                            <label class="layui-form-label">地区选择：</label>
                            <div class="layui-input-inline">
                                <select name="province" lay-search="" id="province"  lay-filter="province">
                                    <option value="">---- 请选择省 ----</option>
                                    {foreach name="province" item="vo"}
                                    <option value="{$vo.district_id}" {$info.school_sheng==$vo.district_id?'selected':''}>{$vo.district}</option>
                                    {/foreach}
                                </select>
                            </div>
                            <div class="layui-input-inline">
                                <select name="city" lay-search=""  id="city"  lay-filter="city">
                                    <option value="">---- 请选择市 ----</option>
                                    {foreach name="city" item="vo"}
                                    <option value="{$vo.district_id}" {$info.school_shi==$vo.district_id?'selected':''}>{$vo.district}</option>
                                    {/foreach}
                                </select>
                            </div>
                            <div class="layui-input-inline">
                                <select name="district" lay-search="" id="district" lay-filter="district">
                                    <option value="">---- 请选择区 ----</option>
                                    {foreach name="district" item="vo"}
                                    <option value="{$vo.district_id}" {$info.school_qu==$vo.district_id?'selected':''}>{$vo.district}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>
                        <input type="hidden" name="school_id" value="{$school_id}">
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit="" lay-filter="component-form-element">保存
                                </button>
                                <button class="layui-btn layui-btn-primary" onclick="history.go(-1)">关闭</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script>
    layui.use(['form','upload','layedit'], function() {
        var form = layui.form;
        form.on('submit(component-form-element)', function (data) {
            $('.layui-btn').addClass('layui-disabled').attr('disabled','disabled');
            $.ajax({
                url:"{:url('schoolEdit')}",
                type:'post',
                dataType:'json',
                data:data.field,
                success:function(res){
                    if (res.code == 200) {
                        wk.success(res.msg,"{:url('School/index')}")
                    } else {
                        wk.error(res.msg,'','$(".layui-btn").removeClass(\'layui-disabled\').removeAttr(\'disabled\');');
                    }
                }
            })
        });
    });
</script>

</body>
</html>
